<? if ($this->is_user==true): ?>
<form action="forum/edit_topic.html" method="GET" class="field">
    <button type="submit"><img src="/manager/media/style/MODxCarbon/images/icons/add.png" alt="Добавить тему"/> Добавить тему</button>
</form>
<? endif; ?>


<?foreach ($this->topics as $row):?>
<div class="topic">
    <?if ($this->is_admin):?>
    <div class="control">
        <a href="forum/edit_topic/<?=$row->id?>" class="edit" title="Редактировать тему"><img src="/manager/media/style/MODxCarbon/images/icons/save.png" alt="Редактировать тему"/></a>
        <a href="forum/delete_topic/<?=$row->id?>" onclick="return confirm('Удалить, Вы уверены?');" class="delete" title="Удалить тему"><img src="/manager/media/style/MODxCarbon/images/icons/delete.png" alt="Удалить тему"/></a>
    </div>
    <?endif?>

    <div class="user_photo">
        <?if ($row->comment):?>
        <img src="<?=$row->comment->user->get_photo("small")?>" alt="<?=htmlspecialchars($row->comment->fullname)?>"/>
        <?endif?>
    </div>
    <div class="message">
        <h2><a href="forum/topic/<?=$row->id?>#last"><?=htmlspecialchars($row->name)?></a></h2>
        <?if ($row->comment):?>
        <p><strong><?=$row->comment->user->fullname?></strong><br/><?=$this->auto_convert($this->wrap($row->comment->message))?></p>
        <?endif?>
        <div class="info">Создано: <?=$row->user->fullname?>, в <?=mb_strtolower(strftime("%d %b %Y в %H:%M",$row->createdon))?>, сообщений: <?=$row->post_count?></div>
    </div>

</div>
<?endforeach;?>
